

import { View, Text } from '@tarojs/components'
import { Popup } from 'antd-mobile'
import './index.scss'


interface PopoverDownProps{
    visible:boolean,
    setVisible:any,
    file:any,
    index?:number | string,
    download(file,index,type):void
}

function App(props:PopoverDownProps) {

    const {
        visible,
        setVisible,
        file,
        index,
        download
    }=props


    return (
        <Popup
            visible={visible}
            onMaskClick={() => {
                setVisible(false)
            }}
            bodyStyle={{
                borderTopLeftRadius: '8px',
                borderTopRightRadius: '8px',
                // minHeight: '256px'
            }}
        >
            <View className='file_pop'>
                <View className='file_name'>{file?.name || '--'}</View>
                <View className='option_row' onClick={()=>download(file, index,'preview')}>预览</View>
                <View className='option_row' onClick={()=>download(file, index,'download')}>下载</View>
                <View className='line'></View>
                <View className='cancle' onClick={() => setVisible(false)}>取消</View>
            </View>
        </Popup>

    )
}
export default App